/**
 * related to toOrderItem.ui
 * 
 * @Author : chenglm
 * @Timestamp : 2016-07-06
 */
var page = sm("do_Page");
var buttonA = deviceone.mm("do_Animation", "BUTTONTOUCHDOWNS", "app");
var jia = ui("do_Button_1");
var jian = ui("do_Button_2");
var num = ui("do_Label_num");
var max=99, min=0;
//+
jia.on("touch",function(){
	jia.animate(buttonA);
	num.text = num.text*1+1;
	if (num.text == 1 || num.text == 0) {
		page.fire("getServiceMemberCount");
	}
	if(num.text*1>=max){
		num.text=max;
		return;
	}
});
//-
jian.on("touch",function(){
	jian.animate(buttonA);
	num.text = num.text*1-1;
	if (num.text == 1 || num.text == 0) {
		page.fire("getServiceMemberCount");
	}
	if(num.text*1<=min){
		num.text=min;
		return;
	}
});

//自定义事件，获取传递来的值
page.on("numregulas",function(data){
	if(data>0){
		num.text=data;
	}else{
		num.text=0;
	}
});
page.on("setMaxMin",function(data){
	if(data){
		if (data.min >= 0) {
			num.text = data.min;
			min = data.min;
		}
		if (data.max > 0) {
			max = data.max;
		}
	}
});